<?php
$dnaUserID=$dnauserinfo[0]["User_ID"];
if($menuType=="IMAGE")
{
?>
	<script type="text/javascript" src="js/fancybox/jquery.fancybox.js?v=2.1.5"></script> 
	<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox.css?v=2.1.5" media="screen" />
	<script>
	$(document).ready(function(){
		$('.PagePhotoGallery').fancybox();
	});
	</script>

	<div class="dna_nav" style="margin-top:10px;">
		<ul>
			<li><a href="dna_myphoto.php?t=<?php echo $_REQUEST['t']; ?>">My Photos</a></li>
			<li><a href="dna_myalbum.php?t=<?php echo $_REQUEST['t']; ?>">My Album</a></li>
			<!--<li><a href="dna_myphoto.php?t=<?php //echo $_REQUEST['t']; ?>">Shared Album</a></li>-->
			<li><a href="dna_currentphoto.php?t=<?php echo $_REQUEST['t']; ?>">Current Photos</a></li>
			<li><a href="dna_allphoto.php?t=<?php echo $_REQUEST['t']; ?>">All Photos</a></li>
		<?php
			if($_SESSION['Allyfolio_User_ID']==$dnauserinfo[0]["User_ID"])
			{
		?>
			<li><a href="dna_create_photo_album.php?t=<?php echo $_REQUEST['t']; ?>">Create Album</a></li>
		<?php
			}
		?>	
		</ul>
		<div style="clear:both;"></div>
	</div>
<?php	
}
else if($menuType=="VIDEO")
{
?>
	<script type="text/javascript" src="js/jwplayer.js"></script>
	<div class="dna_nav" style="margin-top:10px;">
		<ul>
			<li><a href="dna_myvideo.php?t=<?php echo $_REQUEST['t']; ?>">My Videos</a></li>
			<li><a href="dna_myalbum_video.php?t=<?php echo $_REQUEST['t']; ?>">My Album</a></li>
			<!--<li><a href="dna_myphoto.php?t=<?php //echo $_REQUEST['t']; ?>">Shared Album</a></li>-->
			<li><a href="dna_currentvideo.php?t=<?php echo $_REQUEST['t']; ?>">Current Videos</a></li>
			<li><a href="dna_allvideo.php?t=<?php echo $_REQUEST['t']; ?>">All Videos</a></li>
		<?php
			if($_SESSION['Allyfolio_User_ID']==$dnauserinfo[0]["User_ID"])
			{
		?>
			<li><a href="dna_create_video_album.php?t=<?php echo $_REQUEST['t']; ?>">Create Album</a></li>
		<?php
			}
		?>
		</ul>
		<div style="clear:both;"></div>
	</div>
<?php	
}
?>
<?php
	function displayTabularStructure($arr, $mediaType)
	{
		global $dnaUserID;
	?>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<?php	
		for($i=0; $i<count($arr); $i++)
		{
?>
			<tr>
				<td rowspan="3" valign="top">
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="" && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=213&height=214&cropratio=213:214";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>				
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=213&height=214&cropratio=213:214";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=213&height=214&cropratio=213:214";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>	
				</td>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=216&height=166&cropratio=216:166"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=216&height=166&cropratio=216:166";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
				</td>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=216&height=166&cropratio=216:166"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=216&height=166&cropratio=216:166";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
				</td>
				<td rowspan="3" valign="top">
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=213&height=214&cropratio=213:214";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=213&height=214&cropratio=213:214";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=213&height=214&cropratio=213:214";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>	
				</td>
			</tr>
			<tr>
				<td colspan="2" valign="top">
					<div class="box3">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=442&height=249&cropratio=442:249"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=442&height=249&cropratio=442:249";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
				</td>
			</tr>
			<tr>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=216&height=166&cropratio=216:166"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=216&height=166&cropratio=216:166";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
				</td>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						<a href="<?php echo $arr[$i]["Media_Path"]; ?>" class="PagePhotoGallery" data-fancybox-group="PagePhotoGallery">
				<?php		
					}
				?>	
							<img src="<?php if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!=""){ echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=216&height=166&cropratio=216:166"; } else { $i++; echo "uploads/image_crop.php?image=/images/dummy_image.jpg&width=216&height=166&cropratio=216:166";  } ?>" />
				<?php
					if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
					{
				?>
						</a>
				<?php		
					}
				?>			
					</div>
				</td>
			</tr>
	<?php
		}	
	?>	
		</table>
<?php		
	}
	
	function displayTabularStructureVideo($arr, $mediaType)
	{
		global $dnaUserID;
	?>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<?php	
		for($i=0; $i<count($arr); $i++)
		{
?>
			<tr>
				<td rowspan="3" valign="top">
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
					<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:213px;height:214px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "213",
                                                "height": "214"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=213&height=214&cropratio=213:214"."\" alt=\"Video\">";  
						} 
						$i++;
					?>
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:213px;height:214px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "213",
                                                "height": "214"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=213&height=214&cropratio=213:214"."\" alt=\"Video\">";  
						} 
						$i++;
					?>
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:213px;height:214px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "213",
                                                "height": "214"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=213&height=214&cropratio=213:214"."\" alt=\"Video\">";  
						} 
						$i++;
					?>
					</div>	
				</td>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:216px;height:116px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "216",
                                                "height": "166"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=216&height=166&cropratio=216:166"."\" alt=\"Video\">"; 
						} 
						$i++;
					?>
					</div>
				</td>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:216px;height:116px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "216",
                                                "height": "166"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=216&height=166&cropratio=216:166"."\" alt=\"Video\">"; 
						} 
						$i++;
					?>
					</div>
				</td>
				<td rowspan="3" valign="top">
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:213px;height:214px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "213",
                                                "height": "214"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=213&height=214&cropratio=213:214"."\" alt=\"Video\">";  
						} 
						$i++;
					?>
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:213px;height:214px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "213",
                                                "height": "214"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=213&height=214&cropratio=213:214"."\" alt=\"Video\">";  
						} 
						$i++;
					?>
					</div>
					<div class="box1">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:213px;height:214px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "213",
                                                "height": "214"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=213&height=214&cropratio=213:214"."\" alt=\"Video\">";  
						} 
						$i++;
					?>
					</div>	
				</td>
			</tr>
			<tr>
				<td colspan="2" valign="top">
					<div class="box3">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:442px;height:249px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "442",
                                                "height": "249"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{  
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=442&height=249&cropratio=442:249"."\" alt=\"Video\">"; 
						} 
						$i++;
					?>
					</div>
				</td>
			</tr>
			<tr>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:216px;height:116px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "216",
                                                "height": "166"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=216&height=166&cropratio=216:166"."\" alt=\"Video\">"; 
						} 
						$i++;
					?>
					</div>
				</td>
				<td valign="top">
					<div class="box2">
					<?php
	    				if($dnaUserID==$_SESSION['Allyfolio_User_ID'] && isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
	    				{
					?>	
	    				<span class="delete-button">
	    					<a href="javascript:void(0);" onclick="return deletePostMedia('<?php echo $arr[$i]['Media_Upload_ID']; ?>');">X</a>
						</span>
					<?php
						}
					?>
						<?php 
						if(isset($arr[$i]["Media_Path"]) && $arr[$i]["Media_Path"]!="")
						{ 
							//echo "uploads/image_crop.php?image=/".$arr[$i++]["Media_Path"]."&width=213&height=214&cropratio=213:214"; 
							echo '<div id="videouploaded_'.$i.'" style="width:216px;height:116px;"></div>
                                        <script type="text/javascript">
                                            jwplayer("videouploaded_'.$i.'").setup({
                                                "flashplayer": "js/jwplayer.flash.swf",
                                                "file": "'.$arr[$i]["Media_Path"].'",
                                                "image": "images/dummy_video.jpg",
                                                "controlbar": "bottom",
                                                "width": "216",
                                                "height": "166"
                                            });
                                        </script>
                                    </div> ';
						} 
						else 
						{ 
							echo "<img src=\""."uploads/image_crop.php?image=/images/dummy_video.jpg&width=216&height=166&cropratio=216:166"."\" alt=\"Video\">"; 
						} 
						$i++;
					?>
					</div>
				</td>
			</tr>
	<?php
		}	
	?>	
		</table>
<?php		
	}
?>
<script>
function deletePostMedia(postMediaID)
{
	if(postMediaID>0)
    {
        alertify.confirm("Are you sure, you want to delete this?", function (e) {
    		if (e) {
    			$.ajax({
                  cache:false,  
                  async:false,
                  url: "ajax_dna_album.php?purpose=deletemedia&postMediaID="+postMediaID,
            	  success: function( data ) {
            	  	resArr=data.split("|~|");
            	  	//console.log(":"+resArr[0]+":");
					if(resArr[0]=="SUCCESS")
					{
						window.location.reload();
					}
					else
					{
						alertify.alert(resArr[1]);
					}
            	  }
            	});
    		}
    	});
     }	
}
function deleteAlbum(postid)
{
    if(postid>0)
    {
        alertify.confirm("Are you sure, you want to delete this Album?", function (e) {
    		if (e) {
    			$.ajax({
                  cache:false,  
                  async:false,
                  url: "ajax_dna_album.php?purpose=deletepost&postid="+postid,
            	  success: function( data ) {
            	  	resArr=data.split("|~|");
					if(resArr[0]=="SUCCESS")
					{
						window.location.reload();
					}
					else
					{
						alertify.alert(resArr[1]);
					}
            	  }
            	});
    		}
    	});
     }
}
</script>